#!/bin/bash

ZBS_PATH=${0%/*/*}
if [ ! -d $ZBS_PATH ]; then ZBS_PATH=${PWD%/*}; fi
ZBS_BIN="$ZBS_PATH/ZeroBraneStudio/bin"
if [[ ! -e "$ZBS_BIN/libedit.3.dylib" && ! -e /usr/lib/libedit.3.dylib ]]
then ln -s /usr/lib/libedit.2.dylib "$ZBS_BIN/libedit.3.dylib"; fi
export DYLD_LIBRARY_PATH="$ZBS_BIN${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
(cd "$ZBS_PATH/ZeroBraneStudio"; bin/lua src/main.lua zbstudio "$@")
